home *** CD-ROM | disk | FTP | other *** search
- global bgOffset
-
- on init_ParticleConstants
- global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_lockParticles, p_LockPic, p_StartSize, p_ScaleRate, p_RotatePic
- p_StartSprite = 150
- p_MaxParticles = 10
- p_MaxFrames = [20, 11, 7, 4, 20]
- p_FrameDelay = [1, 1, 1, 1, 1]
- p_FrameTitle = ["Blast", "SBlast", "tBlast", "Laser", "Gran-daddy-metal"]
- p_StartFade = [100, 100, 100, 100, 50]
- p_FadeIncrement = -2
- p_InkType = 37
- p_SpawnTimer = 0
- p_RandomFlip = 0
- p_RotatePic = 1
- p_LockPic = 0
- p_StartSize = point(6, 15)
- p_ScaleRate = point(0, 0)
- p_lockParticles = 1
- end
-
- on init_Particles
- global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, particleData
- particleData = []
- repeat with wEntry = 1 to p_MaxParticles
- wSprite = p_StartSprite + wEntry - 1
- add(particleData, [0, 0, 0, point(0, 0)])
- sprite(wSprite).visible = 0
- puppetSprite(wSprite, 1)
- set the member of sprite wSprite to p_FrameTitle[1] & " 1"
- set the ink of sprite wSprite to p_InkType
- set the loc of sprite wSprite to point(0, 0)
- sprite(wSprite).locZ = 450
- end repeat
- end
-
- on addparticle spawnPoint, SpawnRotate, spawnType
- global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_RotatePic, particleData, p_lockParticles
- if p_lockParticles = 1 then
- validSlot = 0
- repeat with wSlot = 1 to p_MaxParticles
- if (validSlot = 0) and (particleData[wSlot][1] = 0) then
- validSlot = wSlot
- end if
- end repeat
- if validSlot <> 0 then
- particleData[validSlot] = [spawnType, 0, 0, spawnPoint]
- wSprite = p_StartSprite + validSlot - 1
- set the loc of sprite wSprite to spawnPoint + bgOffset
- set the member of sprite wSprite to p_FrameTitle[spawnType] & " 1"
- set the blend of sprite wSprite to p_StartFade[spawnType]
- sprite(wSprite).rotation = SpawnRotate
- sprite(wSprite).visible = 1
- end if
- end if
- end
-
- on moveParticles
- global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_LockPic, p_StartSize, p_ScaleRate, particleData, playerViewPoint
- playerViewPoint = point(0, 0)
- p_SpawnTimer = p_SpawnTimer + 1
- if p_SpawnTimer > 36500 then
- p_SpawnTimer = 1
- end if
- repeat with wEntry = 1 to p_MaxParticles
- wSprite = p_StartSprite + wEntry - 1
- if particleData[wEntry][1] <> 0 then
- eType = particleData[wEntry][1]
- if particleData[wEntry][3] <= 1 then
- particleData[wEntry][3] = p_FrameDelay[eType]
- particleData[wEntry][2] = particleData[wEntry][2] + 1
- if particleData[wEntry][2] > p_MaxFrames[eType] then
- particleData[wEntry][1] = 0
- sprite(wSprite).visible = 0
- else
- if (p_LockPic = 0) and (eType <> 5) then
- set the member of sprite wSprite to p_FrameTitle[eType] & " " & string(particleData[wEntry][2])
- else
- set the blend of sprite wSprite to p_StartFade[eType] + (p_FadeIncrement * particleData[wEntry][2])
- end if
- end if
- else
- particleData[wEntry][3] = particleData[wEntry][3] - 1
- end if
- set the loc of sprite wSprite to particleData[wEntry][4] - playerViewPoint + bgOffset
- next repeat
- end if
- end repeat
- end
-